﻿@model IEnumerable<PessModel.Activity>

@{
    ViewBag.Title = "Events";
}
<h2>Events</h2>
@if(Roles.IsUserInRole(Membership.GetUser().UserName,"Admin"))
{
    <div id="operate" class="formSearch">
    @using(Html.BeginForm("Index","Activity",FormMethod.Get)){
    <div>
        @Html.DropDownList("PessTypeID",(string)ViewBag.pessType) <input type="submit" value="Search">
        &#8195;&nbsp;@Html.ActionLink("New", "Create")
    </div>}
    </div>
}


<div id="itemList">
@foreach (var item in Model) {
    <dl onclick="window.location.href='/Activity/Details/'+this.id;" id=@item.ID>
        <dt>
            @*@Html.DisplayFor(modelItem => item.Name)*@
            @Html.ActionLink(item.Name,"Details", new { id=item.ID })
        </dt>
        <dd class="desc">
@*            @{
                string description = item.Description;
                description = description.StripHtmlTags();
                description = description.Truncate(150);                
              }
            @Html.DisplayFor(modelItem => description)*@
        </dd>
        <dd class="startTime">
            <!--[if lte IE 8]>
                Start Date：
            <![endif]-->
            @Html.DisplayFor(modelItem => item.StartDate) 
        </dd>
        <dd class="dueTime">
            <!--[if lte IE 8]>
                End Date：
            <![endif]-->
            @Html.DisplayFor(modelItem => item.DueDate) 
        </dd>
        <dd class="pic">
            @Html.PhotoImage(string.Format("~/images/")+item.Status+".png")
            @*@Html.DisplayFor(modelItem=>item.Status)*@
        </dd>
        <dd class="link">
            @Html.ActionLink("Details", "Details", new { id=item.ID })
            @if(Roles.IsUserInRole(Membership.GetUser().UserName,"Admin"))
            {
                <span> | </span>@Html.ActionLink("Delete", "Delete", new { id=item.ID })
            }
        </dd>
    </dl>
}
</div>




